package org.store.domain;

public class Payment extends Identified {
    private final String info;
    private final int amount; // (cents)

    public Payment(int amount, String info) {
        this.amount = amount;
        this.info = info;
    }

    public String getInfo() {
        return info;
    }

    public int getAmount() {
        return amount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Payment)) return false;

        Payment payment = (Payment) o;

        if (amount != payment.amount) return false;
        if (info != null ? !info.equals(payment.info) : payment.info != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = info != null ? info.hashCode() : 0;
        result = 31 * result + amount;
        return result;
    }
}
